<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script type="text/javascript" src="<?php echo base_url().'assets/js/jquery.min.js';?>"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/lib/bootstrap3/js/bootstrap.min.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $("#load-more").live('click',function(e){
            e.preventDefault();
            var button = $("#load-more");
            button.html("Loading...");
            var offset = $("#offset-value").val();
            var data = {'offset':offset};
            var link = '';
            $.ajax({
                type:'post',
                url:'<?php echo base_url(); ?>dig_feeds/get_more_feeds',
                data:data,
                dataType:'json',
                success:function(data)
                {
                    if(data.error == 'error'){
                        alert("no more feeds to load");
                    }
                    else
                    {
                        for(i in data)
                        {
                            $("#feed-content").append("<div class='feed-image pull-left'><img src='<?php echo IMAGE_UPLOAD_DIR; ?>thumbnail/"+data[i].strPicture+"'></div>");
                            $("#feed-content").append("<h4><a href='"+data[i].link+"' target='_blank'>"+data[i].strTitle+'</a></h4><hr class="clear" />');
                        }
                        new_offset = parseInt(offset)+data.length;
                        $("#offset-value").attr('value',new_offset);
                        button.html("Load More");
                    }
                }
                
            
            });
        });
    });
</script>
</body>
</html>